//
//  CpImageModel.swift
//
//  Created by eme on 2016/12/13
//  Copyright (c) . All rights reserved.
//

import Foundation
import SwiftyJSON
import ModelProtocol
/// 轮播图
 class CpImageModel: ModelProtocol {

    // MARK: Declaration for string constants to be used to decode and also serialize.
	internal let kCpImageImcuseridKey: String = "imcuserid"
	internal let kCpImageImsrcKey: String = "imsrc"
	internal let kCpImageItidKey: String = "itid"
	internal let kCpImageImrefflagKey: String = "imrefflag"
	internal let kCpImageImbdateKey: String = "imbdate"
	internal let kCpImageImidKey: String = "imid"
	internal let kCpImageImtitleKey: String = "imtitle"
	internal let kCpImageRefKey: String = "ref"
	internal let kCpImageImcdateKey: String = "imcdate"
	internal let kCpImageImedateKey: String = "imedate"
	internal let kCpImageImcusernameKey: String = "imcusername"


    // MARK: 属性
	 var imcuserid: Int
	 var imsrc: String
	 var itid: Int
	 var imrefflag: String
	 var imbdate: String
	 var imid: Int
	 var imtitle: String
	 var ref: String
	 var imcdate: String
	 var imedate: String
	 var imcusername: String


    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
		imcuserid = json[kCpImageImcuseridKey].intValue
		imsrc = json[kCpImageImsrcKey].stringValue
		itid = json[kCpImageItidKey].intValue
		imrefflag = json[kCpImageImrefflagKey].stringValue
		imbdate = json[kCpImageImbdateKey].stringValue
		imid = json[kCpImageImidKey].intValue
		imtitle = json[kCpImageImtitleKey].stringValue
		ref = json[kCpImageRefKey].stringValue
		imcdate = json[kCpImageImcdateKey].stringValue
		imedate = json[kCpImageImedateKey].stringValue
		imcusername = json[kCpImageImcusernameKey].stringValue

    }


    /**
    Generates description of the object in the form of a NSDictionary.
    - returns: A Key value pair containing all valid values in the object.
    */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {

        var dictionary: [String : AnyObject ] = [ : ]
		dictionary.updateValue(imcuserid as AnyObject, forKey: kCpImageImcuseridKey)
		dictionary.updateValue(imsrc as AnyObject, forKey: kCpImageImsrcKey)
		dictionary.updateValue(itid as AnyObject, forKey: kCpImageItidKey)
		dictionary.updateValue(imrefflag as AnyObject, forKey: kCpImageImrefflagKey)
		dictionary.updateValue(imbdate as AnyObject, forKey: kCpImageImbdateKey)
		dictionary.updateValue(imid as AnyObject, forKey: kCpImageImidKey)
		dictionary.updateValue(imtitle as AnyObject, forKey: kCpImageImtitleKey)
		dictionary.updateValue(ref as AnyObject, forKey: kCpImageRefKey)
		dictionary.updateValue(imcdate as AnyObject, forKey: kCpImageImcdateKey)
		dictionary.updateValue(imedate as AnyObject, forKey: kCpImageImedateKey)
		dictionary.updateValue(imcusername as AnyObject, forKey: kCpImageImcusernameKey)

        return dictionary
    }


}
